home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / CC_C / 0574.ZIP / GETMAIL.C < prev    next >
C/C++ Source or Header  |  1986-08-11  |  683b  |  34 lines

  1. #include <stdio.h>
  2. main (argc, argv)
  3. int argc; 
  4. char *argv[];
  5. {
  6.     char c;
  7.     int count, nomore;
  8.     extern char *mktemp ();
  9.     char *tmpname, tmp[20];
  10.     char buf[BUFSIZ];
  11.         char to[BUFSIZ];
  12.     FILE *input;
  13.     FILE *output;
  14.  
  15.     tmpname = mktemp ("sparkXXXXXX");
  16.     output = fopen (tmpname, "w");
  17.  
  18.         strcpy (to, "Who-Knows???");
  19.     nomore = count = 0;
  20.     while (gets (buf) != NULL)
  21.     {
  22.         count += strlen (buf) + 1;
  23.         fprintf (output, "%s\n", buf);
  24.     }
  25.     fclose (output);
  26.     input = fopen (tmpname, "r");
  27.     printf ( "#! MAIL-%s %d\n", argv[1], count);
  28.     while (fgets (buf, BUFSIZ, input) != NULL)
  29.         printf ( "%s", buf);
  30.     fclose (input);
  31.     unlink (tmpname);
  32.     exit (0);
  33. }
  34.